package com.liwei.lwmail.product.config;

import com.baomidou.mybatisplus.extension.plugins.PaginationInterceptor;
import org.mybatis.spring.annotation.MapperScan;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.transaction.annotation.EnableTransactionManagement;

@Configuration
@EnableTransactionManagement//开启事务
@MapperScan("com.liwei.lwmail.product.dao")
public class MybatisConfig {

    //引入分页插件
    @Bean
    public PaginationInterceptor PaginationInterceptor(){
        PaginationInterceptor paginationInterceptor = new PaginationInterceptor();
        //请求的页大于最后一页，true跳回首页，默认false继续请求
        paginationInterceptor.setOverflow(true);
        //设置单页最大数量,默认500条,-1不限制
        paginationInterceptor.setLimit(1000);
        return paginationInterceptor;
    }
}
